<?php #//AJAX PHP PENNY AUCTION v.1.2

#////////////////////////////////////////////////////////////////
#//  COPYRIGHT 2009-2010 Aaron Helmlinger ALL RIGHTS RESERVED  //
#////////////////////////////////////////////////////////////////
                    require('../includes/config.inc.php');
include "loggedin.inc.php";


if ( $_POST['getfile']){

 $getfile = $_POST['getfile'];
   
$file_retrieved =  file_get_contents("$getfile");

$ERR = $MSG_AJAX_ADMIN_CONTENT_EDITOR_PAGE_RETREIVED;

                        }
                        
      
      
if ( $_POST['update'] == 1) {


$file = $_POST['file'];
$file_retrieved_backup =  file_get_contents("$file");

 $file_update = $_POST['file_update'];
 $file_backup = $_POST['file'];
 $file_backup .= "_backup";
 
 $fh = fopen($file,w);
fwrite($fh, stripslashes($file_update));
fclose($fh);
  
  
    $fh = fopen($file_backup,w);
fwrite($fh, stripslashes($file_retrieved_backup));  
fclose($fh);
  
  
 $ERR = $MSG_AJAX_ADMIN_CONTENT_EDITOR_PAGE_SAVED;

 $file_retrieved =  file_get_contents("$file");
  $getfile = $file;
  
  
  
  
  
}     


if ( $_POST['update'] == 2 ) {

 $file = $_POST['file'];
 
 $file_backup = $_POST['file_backup'];


   $file_retrieved =  file_get_contents("$file_backup");

   $fh = fopen($file,w);
fwrite($fh, $file_retrieved);
fclose($fh);

   $getfile = $file;
     
  $ERR = $MSG_AJAX_ADMIN_CONTENT_EDITOR_PAGE_RESTORED;

      

}



      
                        
 ?>
 
 
 
 
 

<HTML>
<HEAD>
<link rel='stylesheet' type='text/css' href='style.css' />
<link href="css/main.css" rel="stylesheet" type="text/css">
</HEAD>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">







<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td>
    
       <? // -------------------------- Admin Tool Heading --------------------------------------?>
       
       
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="titulo">
        <tr> 
          <td class="icono"><img src="images/graph_icon2.gif" width="30" height="26"></td>
                    <td class="breadcrumbs"><p><span><?=$MSG_25_0009?></span>&nbsp;&gt;&gt;&nbsp;<? print $MSG_AJAX_ADMIN_CONTENT_EDITOR_TITLE; ?></p></td>
          
          
          
        </tr>
      </table>
      
      
      
      </td>
  </tr>
  <tr>
    <td align="center" valign="middle">&nbsp;</td>
  </tr>
    <tr> 
    <td align="center" valign="middle">
    
    
    
<TABLE BORDER=0 WIDTH=100% CELLPADDING=0 CELLSPACING=0 BGCOLOR="#FFFFFF">
<TR>
<TD align="center">
<BR>
<FORM NAME=conf ACTION=<?=basename($_SERVER['PHP_SELF'])?> METHOD=POST>


  <? // -------------------------- LIGHT BLUE TITLE BAR --------------------------------------?>

	<TABLE WIDTH="95%" BORDER="0" CELLSPACING="0" CELLPADDING="0"  class="base" ALIGN="CENTER" style="border:1px solid #ccc;">
		<TR>
			<TD ALIGN=CENTER class=title>
				<p><? print $MSG_AJAX_ADMIN_CONTENT_EDITOR_TITLE; ?></p>
			</TD>
		</TR>
		
		
		
		<TR>
		<TD>
		
    
    
    <TABLE WIDTH=100% ALIGN="CENTER" CELLPADDING=0 cellspacing="0" BGCOLOR="#FFFFFF">
		
 <? // -------------------------- ERROR BAR --------------------------------------?>    
 
 <? if ($ERR) { ?>   
    	<TR>
				<TD COLSPAN="2"  class="error"><B>
					<p><? print $ERR; ?></p>
					</B></TD>
			</TR>
	<? } ?>	
    
    	<TR>
			
			
 <? // -------------------------- WHITE BAR --------------------------------------?> 			
				<TD WIDTH="125"> 
					<p class="blue"><? print $MSG_AJAX_ADMIN_CONTENT_EDITOR_SELECT_FILE; ?></p>
					</TD>
					
					
				<TD WIDTH="405">
					<B>
<FORM NAME=getfile ACTION=<?=basename($_SERVER['PHP_SELF'])?> METHOD=POST>
          <? print $MSG_AJAX_ADMIN_CONTENT_EDITOR_SELECT_FILE_NOTE; ?><BR><BR>
			 <SELECT NAME="getfile" >
<? if ( !$getfile ) { $getfile = $MSG_AJAX_ADMIN_CONTENT_EDITOR_SELECT_FILE; } ?>
<OPTION VALUE="<? print $getfile; ?>" selected ><? print $getfile; ?></OPTION>
<OPTION VALUE="">------------------ Page Templates ------------------</OPTION> 		            
<OPTION VALUE="../themes/default/header.php.html">../themes/default/header.php.html      </OPTION>
<OPTION VALUE="../themes/default/footer.php.html">../themes/default/footer.php.html  </OPTION>
<OPTION VALUE="../themes/default/news_box.html">../themes/default/footer.php.html - Homepage Top News Box </OPTION>
<OPTION VALUE="../themes/default/live_auction_news_box.html">../themes/default/footer.php.html - Homepage Live Auction News Box </OPTION>
<OPTION VALUE="../themes/default/template_about_us_php.html">    ../themes/default/template_about_us_php.html  </OPTION>
<OPTION VALUE="../themes/default/template_autobidder_php.html">  ../themes/default/template_autobidder_php.html  </OPTION>
<OPTION VALUE="../themes/default/template_advanced_search.html">   ../themes/default/template_advanced_search.html </OPTION>
<OPTION VALUE="../themes/default/template_empty_search.html">   ../themes/default/template_empty_search.html     </OPTION>
<OPTION VALUE="../themes/default/template_auctions_no_cat.html"> ../themes/default/template_auctions_no_cat.html </OPTION>
<OPTION VALUE="../themes/default/template_auction_paypal_php.html">../themes/default/template_auction_paypal_php.html</OPTION> 
<OPTION VALUE="../themes/default/template_browse_php.html">../themes/default/template_browse_php.html </OPTION>
<OPTION VALUE="../themes/default/template_buybids_paypal_php.html">../themes/default/template_buybids_paypal_php.html   </OPTION>
<OPTION VALUE="../themes/default/template_buybids_php.html"> ../themes/default/template_buybids_php.html          </OPTION>
<OPTION VALUE="../themes/default/template_buying_php.html"> ../themes/default/template_buying_php.html  </OPTION>
<OPTION VALUE="../themes/default/template_change_details_php.html"> ../themes/default/template_change_details_php.html   </OPTION>
<OPTION VALUE="../themes/default/template_complete_history_php.html"> ../themes/default/template_complete_history_php.html  </OPTION>
<OPTION VALUE="../themes/default/template_contact_us_php.html"> ../themes/default/template_contact_us_php.html  </OPTION>
<OPTION VALUE="../themes/default/template_feedback_php.html"> ../themes/default/template_feedback_php.html  </OPTION>
<OPTION VALUE="../themes/default/template_forgotpasswd_php.html">../themes/default/template_forgotpasswd_php.html </OPTION> 
<OPTION VALUE="../themes/default/template_friend_confirmation_php.html"> ../themes/default/template_friend_confirmation_php.html    </OPTION>
<OPTION VALUE="../themes/default/template_friend_php.html">../themes/default/template_friend_php.html     </OPTION> 
<OPTION VALUE="../themes/default/template_how_it_works_php.html">../themes/default/template_how_it_works_php.html      </OPTION>
<OPTION VALUE="../themes/default/template_index_php.html">../themes/default/template_index_php.html   </OPTION>
<OPTION VALUE="../themes/default/template_item_php.html">../themes/default/template_item_php.html   </OPTION>
<OPTION VALUE="../themes/default/template_item_watch_php.html">   ../themes/default/template_item_watch_php.html</OPTION>
<OPTION VALUE="../themes/default/template_live_auctions_php.html"> ../themes/default/template_live_auctions_php.html</OPTION>
<OPTION VALUE="../themes/default/template_news_php.html">../themes/default/template_news_php.html      </OPTION>
<OPTION VALUE="../themes/default/template_passwd_sent_php.html">../themes/default/template_passwd_sent_php.html  </OPTION>
<OPTION VALUE="../themes/default/template_payments_php.html"> ../themes/default/template_payments_php.html    </OPTION>
<OPTION VALUE="../themes/default/template_privacy_policy_php.html">../themes/default/template_privacy_policy_php.html    </OPTION>
<OPTION VALUE="../themes/default/template_register_php.html">../themes/default/template_register_php.html  </OPTION>
<OPTION VALUE="../themes/default/template_terms_and_conditions_php.html">  ../themes/default/template_terms_and_conditions_php.html  </OPTION>
<OPTION VALUE="../themes/default/template_upcoming_auctions_php.html"> ../themes/default/template_upcoming_auctions_php.html</OPTION>
<OPTION VALUE="../themes/default/template_winners_testimonials_php.html">../themes/default/template_winners_testimonials_php.html      </OPTION>
<OPTION VALUE="../themes/default/template_user_login_php.html">../themes/default/template_user_login_php.html  </OPTION>
<OPTION VALUE="../themes/default/template_yourbids_php.html">../themes/default/template_yourbids_php.html     </OPTION>
<OPTION VALUE="../themes/default/template_yourfeedback_php.html">../themes/default/template_yourfeedback_php.html </OPTION>
<OPTION VALUE="">-------------------- CSS Files ---------------------</OPTION>
<OPTION VALUE="../global_ie6.css">../global_ie6.css  </OPTION>
<OPTION VALUE="../global_ie7.css">../global_ie7.css  </OPTION>
<OPTION VALUE="../global_ie8.css">../global_ie8.css  </OPTION>
<OPTION VALUE="../global_not_ie.css">../global_not_ie.css  </OPTION>
<OPTION VALUE="">-------- Live & Upcoming Auctions Layout File ------</OPTION>
<OPTION VALUE="../includes/live_and_upcoming_auction.inc.php">../includes/live_and_upcoming_auction.inc.php </OPTION> 
<OPTION VALUE="../includes/live_and_upcoming_auction_all.inc.php">../includes/live_and_upcoming_auction_all.inc.php </OPTION> 
<OPTION VALUE="">---------------- Header Menus & Links --------------</OPTION>
<OPTION VALUE="../tab_menu.php"> ../tab_menu.php    </OPTION>
<OPTION VALUE="../tab_submenu.php"> ../tab_submenu.php </OPTION>
<OPTION VALUE="../category_menu.php"> ../category_menu.php</OPTION>
<OPTION VALUE="">---------------- Email Files -----------------------</OPTION>
                            friendmail.EN.inc.php

<OPTION VALUE="../includes/mail_endauction_youwin_nodutch.EN.inc.php">../includes/mail_endauction_youwin_nodutch.EN.inc.php ( Winner Email )</OPTION> 
<OPTION VALUE="">------Registration Page State / Provinces Files-----</OPTION>
<OPTION VALUE="../themes/default/states_provinces_counties.php">../themes/default/states_provinces_counties.php ( Register Page )</OPTION> 



</SELECT>  	 
			       
	<INPUT TYPE="submit" NAME="act" VALUE="<? print $MSG_AJAX_ADMIN_CONTENT_EDITOR_OPEN_FILE; ?>" class="action">
  </form>		
  
  		       <BR><BR>
					
					</B> </TD>
			</TR>
			        
		 <? // -------------------------- GREY BAR --------------------------------------?>	
			
			<TR>
				<TD WIDTH="125" class="gris">
					<p class="blue">File Edit Box</p>
					</TD>
				<TD WIDTH="405" class="gris">
   <FORM NAME=file_save ACTION=<?=basename($_SERVER['PHP_SELF'])?> METHOD=POST>
    
<textarea name="file_update" cols="100" rows="80">


<? print $file_retrieved; ?>
</textarea><br>


        
        
				</TD>
			</TR>
			  </TABLE>
	
	<INPUT TYPE="submit" NAME="act1" VALUE="<? print $MSG_AJAX_ADMIN_CONTENT_EDITOR_SAVE_FILE; ?>" class="action">
   <input type=hidden name=update value=1 >
    <input type=hidden name=file value=<? print $getfile; ?> >
  </form>	
  
  
<FORM NAME=file_restore ACTION=<?=basename($_SERVER['PHP_SELF'])?> METHOD=POST>
          <input type=hidden name=update value=2 >
    <input type=hidden name=file_backup value=<? print $getfile; ?>_backup >
     <input type=hidden name=file value=<? print $getfile; ?> >
    <INPUT TYPE="submit" NAME="act1" VALUE="<? print $MSG_AJAX_ADMIN_CONTENT_EDITOR_RESTORE_FILE; ?>" class="action">
        </form>
		 </TD>
			</TR>
		</TABLE>
		</TD>
		</TR>
	</TABLE>
	</FORM>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
